package com.mdd.admin.crontab;


import com.mdd.admin.service.IOrderMenuService;
import com.mdd.admin.service.IOrderService;
import com.mdd.common.entity.order.OrderMenu;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;


/**
 * 具体的定时任务
 */
@Component("myJob")
public class MyJob  {

    @Resource
    IOrderMenuService iOrderMenuService;

    @Resource
    IOrderService iOrderService;

    public void handle(String s) {
        // System.out.println("有参数定时任务执行逻辑 : " + s);
    }

    public void updateMenu() {
        // 查询下一个菜单
        OrderMenu menu = iOrderMenuService.getNextMenu();
        if (menu != null) {
            // 设置有效
            iOrderMenuService.setValid(menu.getId());
        }
    }

    public void updateOrderCoupon() {
        iOrderService.fallbackCoupon();
    }
}
